import 'package:flutter/material.dart';
import 'package:flutter_oldman_health/pages/login_page.dart';
import 'package:flutter_oldman_health/navigator/tab_navigator.dart';

// ignore: must_be_immutable
class SplashPage extends StatelessWidget {
  bool hasLogin = false;

  void go(BuildContext context) {
    //UserInfo.setUserIdSharePreferences(1);
    Navigator.push(
        context,
        MaterialPageRoute(
            builder: (context) => hasLogin ? TabNavigation() : LoginPage()));
  }

  @override
  Widget build(BuildContext context) {
    Future.delayed(Duration(seconds: 1), () {}).whenComplete(() => go(context));

    return Container(
        padding: EdgeInsets.only(top: 4),
        child: FractionallySizedBox(
            widthFactor: 1,
            heightFactor: 1,
            child: Image.asset("images/splash.png",
                alignment: AlignmentDirectional.center, fit: BoxFit.fill)));
  }
}
